home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / MATHS / RLAB / RLAB125.ZIP / !RLaB / misc / MAC / diff2 < prev    next >
Text File  |  1994-07-18  |  7KB  |  279 lines

  1. *** console.c    Mon Aug  2 18:17:22 1993
  2. --- myconsole16.c    Sat Apr  9 12:07:38 1994
  3. ***************
  4. *** 1,10 ****
  5.   
  6.   /*
  7. !  *  console.c
  8.    *
  9.    *  Copyright (c) 1991 Symantec Corporation.  All rights reserved.
  10.    *
  11.    */
  12.   
  13.   #include <MacHeaders>
  14.   
  15. --- 1,11 ----
  16.   
  17.   /*
  18. !  *  myconsole16.c    ColorQuickDraw version
  19.    *
  20.    *  Copyright (c) 1991 Symantec Corporation.  All rights reserved.
  21.    *
  22.    */
  23. + #define PLPLOT
  24.   
  25.   #include <MacHeaders>
  26.   
  27. ***************
  28. *** 21,32 ****
  29.   #include "string.h"
  30.   #include "signal.h"
  31.   #include "errno.h"
  32. ! #include "console.h"
  33.   #include "ansi_private.h"
  34.   
  35.   struct __copt console_options = { 50, 10, "\pconsole", 8, 4, 9, 0, 25, 80, 1 };
  36.   char __log_stdout;
  37.   
  38.   static void InitConsole(void);
  39.   static void ProcessEvent(void);
  40.   static WindowPeek new_console(void);
  41. --- 22,45 ----
  42.   #include "string.h"
  43.   #include "signal.h"
  44.   #include "errno.h"
  45. ! /* use new header, tsy */
  46. ! #include "myconsole16.h"
  47.   #include "ansi_private.h"
  48.   
  49.   struct __copt console_options = { 50, 10, "\pconsole", 8, 4, 9, 0, 25, 80, 1 };
  50.   char __log_stdout;
  51.   
  52. + #ifdef PLPLOT
  53. + /* for plplot redraw, tsy */
  54. + extern int pl_redraw_mac(WindowPtr wp);
  55. + RGBColor EraseColor = {65535,65535,65535};
  56. + RGBColor DarkColor  = {0,0,0};
  57. + #endif
  58. + /* for about ... , tsy */
  59. + void AboutBox(void);
  60. + void SetupAboutBox(MenuHandle appleMenu);
  61.   static void InitConsole(void);
  62.   static void ProcessEvent(void);
  63.   static WindowPeek new_console(void);
  64. ***************
  65. *** 320,326 ****
  66.       setup(wp, &save);
  67.       if (on) {
  68.           if (!wp->port.grafProcs) {
  69. !             wp->port.grafProcs = malloc(sizeof(QDProcs));
  70.               SetStdProcs(wp->port.grafProcs);
  71.               wp->port.grafProcs->textProc = (Ptr) myStdText;
  72.           }
  73. --- 333,339 ----
  74.       setup(wp, &save);
  75.       if (on) {
  76.           if (!wp->port.grafProcs) {
  77. !             wp->port.grafProcs = malloc(sizeof(CQDProcs));
  78.               SetStdProcs(wp->port.grafProcs);
  79.               wp->port.grafProcs->textProc = (Ptr) myStdText;
  80.           }
  81. ***************
  82. *** 468,474 ****
  83. --- 481,490 ----
  84.           /*  create menus  */
  85.           
  86.       InsertMenu(appleMenu = NewMenu(1, "\p\024"), 0);
  87. +     AppendMenu(appleMenu, "\p\024");    
  88.       AddResMenu(appleMenu, 'DRVR');
  89. +     /* add about ... tsy */
  90. +     SetupAboutBox(appleMenu);
  91.       InsertMenu(menu = NewMenu(2, "\pFile"), 0);
  92.       AppendMenu(menu, "\pQuit/Q");
  93.       InsertMenu(menu = NewMenu(3, "\pEdit"), 0);
  94. ***************
  95. *** 548,555 ****
  96.   doMenu:    
  97.       switch (hiword(choice)) {
  98.           case 1:        /*  Apple  */
  99. !             GetItem(appleMenu, loword(choice), buf);
  100. !             OpenDeskAcc(buf);
  101.               break;
  102.           case 2:        /*  File  */
  103.               console_options.pause_atexit = 0;
  104. --- 564,575 ----
  105.   doMenu:    
  106.       switch (hiword(choice)) {
  107.           case 1:        /*  Apple  */
  108. !             if (loword(choice) == 1)
  109. !                AboutBox();
  110. !             else {
  111. !                GetItem(appleMenu, loword(choice), buf);
  112. !                OpenDeskAcc(buf);
  113. !             }
  114.               break;
  115.           case 2:        /*  File  */
  116.               console_options.pause_atexit = 0;
  117. ***************
  118. *** 562,567 ****
  119. --- 582,605 ----
  120.       HiliteMenu(0);
  121.   }
  122.   
  123. + /*
  124. +  * draw grow icon, tsy
  125. +  */
  126. +  
  127. + static void
  128. + drawGrow(Rect bounds)
  129. + {
  130. +     /* RGBForeColor(&DarkColor);  */             
  131. +     MoveTo(bounds.right-15,bounds.bottom-15);
  132. +     LineTo(bounds.right,bounds.bottom-15);  
  133. +     MoveTo(bounds.right-15,bounds.bottom-10);
  134. +     LineTo(bounds.right,bounds.bottom-10);  
  135. +     
  136. +     MoveTo(bounds.right-15,bounds.bottom-15);
  137. +     LineTo(bounds.right-15,bounds.bottom);     
  138. +     MoveTo(bounds.right-10,bounds.bottom-15);
  139. +     LineTo(bounds.right-10,bounds.bottom);     
  140. + }
  141.   
  142.   /*
  143.    *  new_console - create a new console window
  144. ***************
  145. *** 582,590 ****
  146.       GetPort(&savePort);
  147.       use(0);
  148.       
  149. !         /*  create the window  */
  150.           
  151. !     wp = (WindowPeek) NewWindow(0, &wbox, console_options.title, 0, console_options.procID, (WindowPtr) -1, 0, 0);
  152.       MoveWindow((WindowPtr)wp, console_options.left, console_options.top, 0);
  153.       SetPort((WindowPtr)(c.wp = wp));
  154.       
  155. --- 620,628 ----
  156.       GetPort(&savePort);
  157.       use(0);
  158.       
  159. !         /*  create the window , ColorQuickDraw tsy */
  160.           
  161. !     wp = (WindowPeek) NewCWindow(0, &wbox, console_options.title, 0, console_options.procID, (WindowPtr) -1, 0, 0);
  162.       MoveWindow((WindowPtr)wp, console_options.left, console_options.top, 0);
  163.       SetPort((WindowPtr)(c.wp = wp));
  164.       
  165. ***************
  166. *** 594,601 ****
  167.       TextSize(console_options.txSize);
  168.       TextFace(console_options.txFace);
  169.       GetFontInfo(&fontInfo);
  170. !     c.height = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
  171. !     c.width = fontInfo.widMax;
  172.       
  173.           /*  set console defaults  */
  174.           
  175. --- 632,639 ----
  176.       TextSize(console_options.txSize);
  177.       TextFace(console_options.txFace);
  178.       GetFontInfo(&fontInfo);
  179. !     c.height = fontInfo.ascent + fontInfo.descent + fontInfo.leading; /* char height*/
  180. !     c.width = fontInfo.widMax;  /*char width*/
  181.       
  182.           /*  set console defaults  */
  183.           
  184. ***************
  185. *** 611,616 ****
  186. --- 649,655 ----
  187.       bounds.bottom = (c.nrows = console_options.nrows) * c.height + 8;
  188.       bounds.right = (c.ncols = console_options.ncols) * c.width + 8;
  189.       SizeWindow((WindowPtr)wp, bounds.right, bounds.bottom, 0);
  190. +     /* drawGrow(bounds); */  /* tsy */
  191.       
  192.           /*  create TE record  */
  193.           
  194. ***************
  195. *** 621,627 ****
  196.       
  197.           /*  set up grow/zoom parameters  */
  198.       
  199. !     c.limit = botRight(bounds);
  200.       ++c.limit.v, ++c.limit.h;
  201.       LocalToGlobal(&topLeft(bounds));
  202.       LocalToGlobal(&botRight(bounds));
  203. --- 660,670 ----
  204.       
  205.           /*  set up grow/zoom parameters  */
  206.       
  207. !     /* c.limit = botRight(bounds); */
  208. !     /* reset grow limit, tsy */
  209. !     c.limit.v = bounds.bottom + 1000;
  210. !     c.limit.h = bounds.right  + 1000;
  211. !     
  212.       ++c.limit.v, ++c.limit.h;
  213.       LocalToGlobal(&topLeft(bounds));
  214.       LocalToGlobal(&botRight(bounds));
  215. ***************
  216. *** 1150,1155 ****
  217. --- 1193,1204 ----
  218.       return(sel);
  219.   }
  220.   
  221. + int
  222. + csetcursor(int sel)
  223. + {
  224. +     setcursor(sel);
  225. + }
  226.   
  227.   /*
  228.    *  deactivate - make sure TE record is inactive
  229. ***************
  230. *** 1252,1257 ****
  231. --- 1301,1315 ----
  232.               BeginUpdate((WindowPtr)wp);
  233.               EraseRect(&bounds);
  234.               TEUpdate(&bounds, c.hTE);
  235. + #ifdef PLPLOT
  236. +             /* redraw PLPLOT graphs, tsy */
  237. +             if (pl_redraw_mac((WindowPtr)wp))
  238. +                DrawGrowIcon((WindowPtr)wp); /* draw growIcon */
  239. + #endif                        
  240. +             /* redraw scroll bars, tsy */
  241. +             /*
  242. +             DrawControls((WindowPtr)wp);
  243. +             */        
  244.               EndUpdate((WindowPtr)wp);
  245.           }
  246.           theConsole = wp;
  247. ***************
  248. *** 1530,1539 ****
  249.   doCursor(void)
  250.   {
  251.       Point where;
  252.       
  253.       TEIdle(c.hTE);
  254.       GetMouse(&where);
  255. !     if (PtInRect(where, &c.wp->port.portRect))
  256.           SetCursor(*GetCursor(iBeamCursor));
  257.       else asm {
  258.           movea.l    (a5),a0
  259. --- 1588,1603 ----
  260.   doCursor(void)
  261.   {
  262.       Point where;
  263. +     Rect  grow;
  264. +     /* tsy */
  265. +     grow.top    = c.wp->port.portRect.bottom - 14;
  266. +     grow.bottom = c.wp->port.portRect.bottom;
  267. +     grow.left   = c.wp->port.portRect.right - 14;
  268. +     grow.right  = c.wp->port.portRect.right;
  269.       
  270.       TEIdle(c.hTE);
  271.       GetMouse(&where);
  272. !     if (PtInRect(where, &c.wp->port.portRect) && !PtInRect(where, &grow))
  273.           SetCursor(*GetCursor(iBeamCursor));
  274.       else asm {
  275.           movea.l    (a5),a0
  276.